package com.tvalition.annoation;

import com.tvalition.pojo.TestDropInfo;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import java.util.ArrayList;
import java.util.List;

/**
 * @author: LCG
 * @date: 2023-03-20 14:58:17
 * @description:
 **/
public class ValidtionConstraint implements ConstraintValidator<ValidList, List<TestDropInfo>> {

    private Class className;

    @Override
    public void initialize(ValidList constraintAnnotation) {
       //这里一般是用来获取，给定ValidList注解中的属性的参数值
        className=constraintAnnotation.className();
    }

    @Override
    public boolean isValid(List<TestDropInfo> testDropInfoList, ConstraintValidatorContext constraintValidatorContext) {

        if(testDropInfoList==null){
            return false;
        }else{
            return true;
        }
    }
}
